/**
 * Created by oneminute on 7/27/14.
 */

var assert = require("assert");
var should = require("should");
var logger = require("../../lib/utils/logger");
var testutils = require("../testutils");
var lz = require("../../lib/utils/modules")();

describe("测试arangodb模块。", function () {

    var user01 = null;

    before(function(done) {
        user01 = new lz.User({
            id: lz.Utils.getUUID("u_"),
            name: lz.Utils.getRandName()
        });
        user01.save(function(_err, _user) {
            done();
        });
    });

    after(function(done) {
        user01.delete(function(_err) {
            done();
        });
    });

    it("测试countObjectByAQL方法。", function (done) {
        lz.ArangoDB.countObjectsByAQL(lz.Config.db.arango.aqls.GET_USER_BY_NAME, {
            "@collection": lz.Config.db.arango.users,
            "name": user01.name
        }, function(_err, _count) {
            testutils.check(done, function() {
                assert.equal(_count, 1);
            });
        });
    });
});
